package com.base.cn.platform.os.service.manage.sysUser;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 登录接口
 *
 * @author s.li
 * @create 2018-03-13 9:41
 */
@FeignClient(name = BaseService.appName,configuration = FeignAuthConfig.class)
public interface SysUserLoginService extends BaseService {

    //执行登录接口
    @RequestMapping(contextPath+"/executeLogin")
    Map<String,Object> executeLogin(@RequestBody Map<String, Object> sysUser,
                                    @RequestParam(value = "gapLeft", required = false, defaultValue = "0") int gapLeft,
                                    @RequestParam(value = "moveLeft", required = false, defaultValue = "0") int moveLeft);

    //执行注册接口
    @RequestMapping(contextPath+"/executeRegister")
    Map<String,Object> executeRegister(@RequestBody Map<String, Object> sysUserForm);

    /**
     * 退出用户登录
     * @param sessionId 会话ID
     * @param userId 登录的用户的ID
     * @return false退出失败，true退出成功
     */
    @RequestMapping(contextPath+"/executeLogout")
    boolean executeLogout(@RequestParam("sessionId") String sessionId, @RequestParam("userId") BigDecimal userId);

    /**
     * 修改当前登录用户的密码
     * @param oldPassword 原密码
     * @param newPassword 新密码
     * @param confirmPassword 确认密码
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/updateThisPwd")
    Map<String,Object> updateThisPwd(@RequestParam("userId") BigDecimal userId,
                                     @RequestParam("oldPassword") String oldPassword,
                                     @RequestParam("newPassword") String newPassword,
                                     @RequestParam("confirmPassword") String confirmPassword);
    /**
     * 发送体验用户注册用验证码
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/sendCaptcha")
    Map<String,Object> sendCaptcha(@RequestParam("mobile") String mobile);
}
